package loader;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SemEvalSent {
	private Integer id;
	private String content;
	public String line;
	public SemEvalSent(String xmlLine)
	{
		setFields(xmlLine);
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		if (id!=null)
		{
			return id;
		}
		else
		{
			setFields(line);
			return id;
		}
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getContent() {
		
		if (content!=null)
		{
			return content;
		}
		else
		{
			setFields(line);
			return content;
		}
	}
//	<instance id="13">United Finds Good Connection in Win</instance>
	 public void setFields(String line)
	{
		
		Pattern p = Pattern.compile("<instance id=\"(\\d+)\">(.*)</instance>");
		Matcher m = p.matcher(line);
		if (m.matches())
		{
			String id = m.group(1);
			String content = m.group(2);
			setContent(content);
			setId(Integer.parseInt(id));
			
		}
		
	}
}
